package com.zang.concurrent.collections.blockingqueue;

import java.util.concurrent.BlockingQueue;

/**
 * @author Zhang Qiang
 * @Date 2019/9/6 17:21
 */
public class Consumer implements Runnable {
    protected BlockingQueue queue = null;
    public Consumer(BlockingQueue queue){
        this.queue = queue;
    }
    @Override
    public void run() {
        try {
            while (true){
                System.out.println(queue.take());
                System.out.println(queue.take());
                System.out.println(queue.take());
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
